<?php
namespace app\common\model;
use think\Db;
use think\Model;

/**
 * 合同补充协议
 * lcx
 */
class ContractAdditionalModel extends Model
{
    // 表名
    protected $name = 'contract_additional';

    // 列表查询
    public function getAll($where=[], $page=1, $pageSize=-1, $field='*',$order='create_time DESC')
    {
        return $this->where($where)
                    ->field($field)
                    ->page($page, $pageSize)
                    ->order($order)
                    ->select();
    }

    // 数量统计
    public function getCount($where=[])
    {
       return $this->where($where)->count();
    }

    // 单条查询
    public function getOne($where, $field='*')
    {
       return $this->where($where)->field($field)->find();
    }

    // 添加
    public function add($data)
    {
        return $this->insertGetId($data);
    }

    // 修改
    public function edit($where, $data)
    {
        return $this->where($where)->update($data);
    }

}